package org.example.easybuy.util;

import java.util.HashMap;

public class CustomResult extends HashMap<String,Object> {
    private CustomResult(int code,String msg)
    {
        this.put("code",code);
        this.put("msg",msg);
    }

    public static CustomResult successResult()
    {
        return new CustomResult(200,"成功");
    }

    public static CustomResult errorResult(int code,String msg)
    {
        return new CustomResult(code,msg);
    }

    public CustomResult addResult(String key,Object value)
    {
        this.put(key,value);
        return this;
    }
}
